home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 17764 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.7 KB  |  42 lines

  1. Newsgroups: comp.lang.c++,comp.lang.eiffel,comp.object,comp.arch
  2. Path: netcom.com!jgk
  3. From: Joe Keane <jgk@netcom.com>
  4. Subject: Re: Real OO
  5. Message-ID: <jgkDpzFnD.KL7@netcom.com>
  6. Summary: It's optimization.
  7. Keywords: function
  8. Sender: jgk@netcom16.netcom.com
  9. Organization: none
  10. References: <65lDeVZF3RB@herold.franken.de> <DpBw9w.Mru@assip.csasyd.oz> <4kbl7r$1i8@gaia.ns.utk.edu> <4ke84h$iiv@watnews1.watson.ibm.com>
  11. Date: Wed, 17 Apr 1996 01:18:49 GMT
  12.  
  13. In article <4kbl7r$1i8@gaia.ns.utk.edu>
  14. Matt Kennel <mbk@caffeine.engr.utk.edu> writes: 
  15. >My experience with Sather numerical classes is that the cost of
  16. >indirect calls is not the actual indirection, but the lost
  17. >opportunities for inlining.
  18.  
  19. In article <4ke84h$iiv@watnews1.watson.ibm.com>
  20. Norman H. Cohen <ncohen@watson.ibm.com> writes:
  21. >Plus the opportunities that arise from cross-procedural analysis, for
  22. >compilers that perform such analysis for statically bound subprograms.
  23. >
  24. >(But remember, in counting the cost of the actual indirection, to count
  25. >machine cycles rather than instruction path length.  Indirect function
  26. >calls can cause expensive I-cache misses on some architectures.)
  27.  
  28. Ding ding ding!  People too often concentrate on the number of
  29. instructions to just do the function call, either static or virtual.
  30.  
  31. In my experience that's not the thing; rather it's that when you inline
  32. a function the compiler has much more oppurtunity for optimization.
  33. This comes from a variety of reasons, and i'm convinced that in real
  34. situations this is more important than a couple cycles to jump.
  35.  
  36. If the function being called isn't known at compile time, the compiler
  37. must assume the worst, even though it's quite likely that the function
  38. will turn out to be something very simple.
  39.  
  40. --
  41. Joe Keane, professional programmer
  42.